package org.easymis.crm.modules.system.entitys.mybatis.mapper;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.easymis.crm.modules.system.entitys.mybatis.dto.OrganizeFunction;

public interface OrganizeFunctionMapper {
	@Select("select * from organize_function")
	@Results(value = { @Result(property = "functionId", column = "function_id"),
			@Result(property = "parentId", column = "sys_code"), @Result(property = "manager", column = "manager"),
			@Result(property = "managerId", column = "manager_id"),
			@Result(property = "roleName", column = "role_name"), @Result(property = "priority", column = "priority"),
			@Result(property = "isSuper", column = "is_super"), @Result(property = "level", column = "level"),
			@Result(property = "depict", column = "depict") })
	public List<OrganizeFunction> getList(HashMap<String, Object> params);

	@Insert("insert into organize_function(function_id,role_name, is_super) values(#{functionId},#{roleName}, #{isSuper})")
	public void save(OrganizeFunction bean);

	public void saveBatch(List<OrganizeFunction> beans);

	@Update("update organize_function set role_name = #{roleName}, is_super = #{isSuper} where function_id = #{functionId}")
	public void update(OrganizeFunction bean);

	@Delete("delete from organize_function where function_id = #{functionId}")
	public void delete(String functionId);

	@Select("select * from organize_function where function_id=#{functionId}")
	@Results(value = { @Result(property = "functionId", column = "function_id"),
			@Result(property = "parentId", column = "sys_code"), @Result(property = "manager", column = "manager"),
			@Result(property = "managerId", column = "manager_id"),
			@Result(property = "roleName", column = "role_name"), @Result(property = "priority", column = "priority"),
			@Result(property = "isSuper", column = "is_super"), @Result(property = "level", column = "level"),
			@Result(property = "depict", column = "depict") })
	public OrganizeFunction findById(String functionId);
}
